package com.lovo.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lovo.sys.bean.PromotionalSchemesBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface IPromoyionalSchemesMapper extends BaseMapper<PromotionalSchemesBean> {

    /**
     * 批量添加商品和促销订单外键
     * @param rate 折扣率
     * @param productId 商品id数组
     * @param promotionalId 促销方案外键
     */
    void addProductByPromotional(@Param("rate") float rate,
                                 @Param("productId") Integer[] productId,
                                 @Param("promotionalId") long promotionalId);

    /**
     * 删除商品和促销订单中间表
     * @param promotionalId 采购id
     */
    void delByPromotionalByProduct(long promotionalId);

    /**
     * 根据商品id查询所有商品
     * @return 商品名对象
     */
    List<String> findByProductId(@Param("productId") Integer[] productId);
}
